{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 49,
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pandas \n",
    "import numpy as numpy\n",
    "\n",
    "import lightgbm as lightgbm\n",
    "from lightgbm.sklearn import LGBMClassifier\n",
    "\n",
    "from sklearn.model_selection import GridSearchCV\n",
    "\n",
    "import matplotlib.pyplot as matplot\n",
    "%matplotlib inline"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 50,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Index([u'Gender', u'City', u'Monthly_Income', u'Loan_Amount_Applied',\n",
       "       u'Loan_Tenure_Applied', u'Existing_EMI', u'Employer_Name',\n",
       "       u'Salary_Account', u'Mobile_Verified', u'Var5', u'Var1',\n",
       "       u'Loan_Amount_Submitted', u'Loan_Tenure_Submitted', u'Interest_Rate',\n",
       "       u'Processing_Fee', u'EMI_Loan_Submitted', u'Filled_Form',\n",
       "       u'Device_Type', u'Var2', u'Source', u'Var4', u'LoggedIn',\n",
       "       u'EMI_Loan_Submitted_Missing', u'Interest_Rate_Missing',\n",
       "       u'Processing_Fee_Missing', u'Age', u'Lead_Creation_Year'],\n",
       "      dtype='object')"
      ]
     },
     "execution_count": 50,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "train = pandas.read_csv(\"FE_train.csv\")\n",
    "test = pandas.read_csv(\"FE_test.csv\")\n",
    "y_train = train['Disbursed'] \n",
    "x_train = train.drop([\"ID\", \"Disbursed\",\"Unnamed: 0\"], axis=1)\n",
    "#保存，用于之后大眼\n",
    "feat_names = x_train.columns \n",
    "feat_names"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 52,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Gender</th>\n",
       "      <th>City</th>\n",
       "      <th>Monthly_Income</th>\n",
       "      <th>Loan_Amount_Applied</th>\n",
       "      <th>Loan_Tenure_Applied</th>\n",
       "      <th>Existing_EMI</th>\n",
       "      <th>Employer_Name</th>\n",
       "      <th>Salary_Account</th>\n",
       "      <th>Mobile_Verified</th>\n",
       "      <th>Var5</th>\n",
       "      <th>...</th>\n",
       "      <th>Device_Type</th>\n",
       "      <th>Var2</th>\n",
       "      <th>Source</th>\n",
       "      <th>Var4</th>\n",
       "      <th>LoggedIn</th>\n",
       "      <th>EMI_Loan_Submitted_Missing</th>\n",
       "      <th>Interest_Rate_Missing</th>\n",
       "      <th>Processing_Fee_Missing</th>\n",
       "      <th>Age</th>\n",
       "      <th>Lead_Creation_Year</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>0</td>\n",
       "      <td>177</td>\n",
       "      <td>20000</td>\n",
       "      <td>300000.0</td>\n",
       "      <td>5.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>11372</td>\n",
       "      <td>22</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>1</td>\n",
       "      <td>6</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0.0</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>40</td>\n",
       "      <td>3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>1</td>\n",
       "      <td>462</td>\n",
       "      <td>35000</td>\n",
       "      <td>200000.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>50790</td>\n",
       "      <td>24</td>\n",
       "      <td>1</td>\n",
       "      <td>13</td>\n",
       "      <td>...</td>\n",
       "      <td>1</td>\n",
       "      <td>6</td>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>33</td>\n",
       "      <td>3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>1</td>\n",
       "      <td>513</td>\n",
       "      <td>22500</td>\n",
       "      <td>600000.0</td>\n",
       "      <td>4.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>2422</td>\n",
       "      <td>46</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>20</td>\n",
       "      <td>1</td>\n",
       "      <td>0.0</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>37</td>\n",
       "      <td>3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>1</td>\n",
       "      <td>591</td>\n",
       "      <td>35000</td>\n",
       "      <td>1000000.0</td>\n",
       "      <td>5.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>7451</td>\n",
       "      <td>46</td>\n",
       "      <td>1</td>\n",
       "      <td>10</td>\n",
       "      <td>...</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>20</td>\n",
       "      <td>3</td>\n",
       "      <td>0.0</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>31</td>\n",
       "      <td>3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>1</td>\n",
       "      <td>89</td>\n",
       "      <td>100000</td>\n",
       "      <td>500000.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>25000.0</td>\n",
       "      <td>17713</td>\n",
       "      <td>22</td>\n",
       "      <td>1</td>\n",
       "      <td>17</td>\n",
       "      <td>...</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>11</td>\n",
       "      <td>3</td>\n",
       "      <td>1.0</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>34</td>\n",
       "      <td>3</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>5 rows × 27 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "   Gender  City  Monthly_Income  Loan_Amount_Applied  Loan_Tenure_Applied  \\\n",
       "0       0   177           20000             300000.0                  5.0   \n",
       "1       1   462           35000             200000.0                  2.0   \n",
       "2       1   513           22500             600000.0                  4.0   \n",
       "3       1   591           35000            1000000.0                  5.0   \n",
       "4       1    89          100000             500000.0                  2.0   \n",
       "\n",
       "   Existing_EMI  Employer_Name  Salary_Account  Mobile_Verified  Var5  \\\n",
       "0           0.0          11372              22                0     0   \n",
       "1           0.0          50790              24                1    13   \n",
       "2           0.0           2422              46                1     0   \n",
       "3           0.0           7451              46                1    10   \n",
       "4       25000.0          17713              22                1    17   \n",
       "\n",
       "          ...          Device_Type  Var2  Source  Var4  LoggedIn  \\\n",
       "0         ...                    1     6       0     1       0.0   \n",
       "1         ...                    1     6       0     3       0.0   \n",
       "2         ...                    1     1      20     1       0.0   \n",
       "3         ...                    1     1      20     3       0.0   \n",
       "4         ...                    1     1      11     3       1.0   \n",
       "\n",
       "   EMI_Loan_Submitted_Missing  Interest_Rate_Missing  Processing_Fee_Missing  \\\n",
       "0                           1                      1                       1   \n",
       "1                           0                      0                       1   \n",
       "2                           1                      1                       1   \n",
       "3                           1                      1                       1   \n",
       "4                           1                      1                       1   \n",
       "\n",
       "   Age  Lead_Creation_Year  \n",
       "0   40                   3  \n",
       "1   33                   3  \n",
       "2   37                   3  \n",
       "3   31                   3  \n",
       "4   34                   3  \n",
       "\n",
       "[5 rows x 27 columns]"
      ]
     },
     "execution_count": 52,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "x_train.head(5)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 53,
   "metadata": {},
   "outputs": [],
   "source": [
    "MAX_ROUNDS = 10000"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "导入交叉验证"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 54,
   "metadata": {},
   "outputs": [],
   "source": [
    "from sklearn.model_selection import StratifiedKFold\n",
    "\n",
    "kfold = StratifiedKFold(n_splits=5, shuffle=True, random_state=3)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 55,
   "metadata": {},
   "outputs": [],
   "source": [
    "def get_n_estimators(params , X_train , y_train , early_stopping_rounds=10):\n",
    "    lgbm_params = params.copy()\n",
    "     \n",
    "    lgbmtrain = lightgbm.Dataset(X_train , y_train )\n",
    "     \n",
    "    #num_boost_round为弱分类器数目，下面的代码参数里因为已经设置了early_stopping_rounds\n",
    "    #即性能未提升的次数超过过早停止设置的数值，则停止训练\n",
    "    cv_result = lightgbm.cv(lgbm_params , lgbmtrain , num_boost_round=MAX_ROUNDS , nfold=5,  metrics='auc' , early_stopping_rounds=early_stopping_rounds,seed=3 )\n",
    "    print cv_result \n",
    "    print('best n_estimators:' , len(cv_result['auc-mean']))\n",
    "    print('best cv score:' , cv_result['auc-mean'][-1])\n",
    "    return len(cv_result['auc-mean'])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 56,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Gender</th>\n",
       "      <th>City</th>\n",
       "      <th>Monthly_Income</th>\n",
       "      <th>Loan_Amount_Applied</th>\n",
       "      <th>Loan_Tenure_Applied</th>\n",
       "      <th>Existing_EMI</th>\n",
       "      <th>Employer_Name</th>\n",
       "      <th>Salary_Account</th>\n",
       "      <th>Mobile_Verified</th>\n",
       "      <th>Var5</th>\n",
       "      <th>...</th>\n",
       "      <th>Device_Type</th>\n",
       "      <th>Var2</th>\n",
       "      <th>Source</th>\n",
       "      <th>Var4</th>\n",
       "      <th>LoggedIn</th>\n",
       "      <th>EMI_Loan_Submitted_Missing</th>\n",
       "      <th>Interest_Rate_Missing</th>\n",
       "      <th>Processing_Fee_Missing</th>\n",
       "      <th>Age</th>\n",
       "      <th>Lead_Creation_Year</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>0</td>\n",
       "      <td>177</td>\n",
       "      <td>20000</td>\n",
       "      <td>300000.0</td>\n",
       "      <td>5.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>11372</td>\n",
       "      <td>22</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>1</td>\n",
       "      <td>6</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0.0</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>40</td>\n",
       "      <td>3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>1</td>\n",
       "      <td>462</td>\n",
       "      <td>35000</td>\n",
       "      <td>200000.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>50790</td>\n",
       "      <td>24</td>\n",
       "      <td>1</td>\n",
       "      <td>13</td>\n",
       "      <td>...</td>\n",
       "      <td>1</td>\n",
       "      <td>6</td>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>33</td>\n",
       "      <td>3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>1</td>\n",
       "      <td>513</td>\n",
       "      <td>22500</td>\n",
       "      <td>600000.0</td>\n",
       "      <td>4.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>2422</td>\n",
       "      <td>46</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>20</td>\n",
       "      <td>1</td>\n",
       "      <td>0.0</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>37</td>\n",
       "      <td>3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>1</td>\n",
       "      <td>591</td>\n",
       "      <td>35000</td>\n",
       "      <td>1000000.0</td>\n",
       "      <td>5.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>7451</td>\n",
       "      <td>46</td>\n",
       "      <td>1</td>\n",
       "      <td>10</td>\n",
       "      <td>...</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>20</td>\n",
       "      <td>3</td>\n",
       "      <td>0.0</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>31</td>\n",
       "      <td>3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>1</td>\n",
       "      <td>89</td>\n",
       "      <td>100000</td>\n",
       "      <td>500000.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>25000.0</td>\n",
       "      <td>17713</td>\n",
       "      <td>22</td>\n",
       "      <td>1</td>\n",
       "      <td>17</td>\n",
       "      <td>...</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>11</td>\n",
       "      <td>3</td>\n",
       "      <td>1.0</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>34</td>\n",
       "      <td>3</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>5 rows × 27 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "   Gender  City  Monthly_Income  Loan_Amount_Applied  Loan_Tenure_Applied  \\\n",
       "0       0   177           20000             300000.0                  5.0   \n",
       "1       1   462           35000             200000.0                  2.0   \n",
       "2       1   513           22500             600000.0                  4.0   \n",
       "3       1   591           35000            1000000.0                  5.0   \n",
       "4       1    89          100000             500000.0                  2.0   \n",
       "\n",
       "   Existing_EMI  Employer_Name  Salary_Account  Mobile_Verified  Var5  \\\n",
       "0           0.0          11372              22                0     0   \n",
       "1           0.0          50790              24                1    13   \n",
       "2           0.0           2422              46                1     0   \n",
       "3           0.0           7451              46                1    10   \n",
       "4       25000.0          17713              22                1    17   \n",
       "\n",
       "          ...          Device_Type  Var2  Source  Var4  LoggedIn  \\\n",
       "0         ...                    1     6       0     1       0.0   \n",
       "1         ...                    1     6       0     3       0.0   \n",
       "2         ...                    1     1      20     1       0.0   \n",
       "3         ...                    1     1      20     3       0.0   \n",
       "4         ...                    1     1      11     3       1.0   \n",
       "\n",
       "   EMI_Loan_Submitted_Missing  Interest_Rate_Missing  Processing_Fee_Missing  \\\n",
       "0                           1                      1                       1   \n",
       "1                           0                      0                       1   \n",
       "2                           1                      1                       1   \n",
       "3                           1                      1                       1   \n",
       "4                           1                      1                       1   \n",
       "\n",
       "   Age  Lead_Creation_Year  \n",
       "0   40                   3  \n",
       "1   33                   3  \n",
       "2   37                   3  \n",
       "3   31                   3  \n",
       "4   34                   3  \n",
       "\n",
       "[5 rows x 27 columns]"
      ]
     },
     "execution_count": 56,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "x_train.head(5)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 57,
   "metadata": {},
   "outputs": [],
   "source": [
    "def getcategorical():\n",
    "    catgorical_col=[]\n",
    "    i=0\n",
    "    for col in feat_names:\n",
    "        if col in categorical_names:\n",
    "            catgorical_col.append(i)\n",
    "        i=i+1\n",
    "    return catgorical_col\n",
    "categorical_feature= getcategorical()  "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 58,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "{u'auc-mean': [0.987150380136774, 0.9868828921315993, 0.9912387683889694, 0.9913541721367926, 0.9913150048883544, 0.9915542483671137, 0.991423739730579, 0.9913581766494601, 0.9913858542980328, 0.9913807987790919, 0.9913605247598867, 0.9913398606156247, 0.9914567070583498, 0.991508510115564, 0.9915882722896331, 0.991620151493148], u'auc-stdv': [0.005474965927077274, 0.006634473955001734, 0.003157576538878999, 0.0028216578002428416, 0.0032673753641725986, 0.003368949593484318, 0.00358110775785263, 0.0036412463737568756, 0.003577234071048115, 0.003550716702997536, 0.003671261412892389, 0.003746384356267733, 0.0038948495491087577, 0.003944358242801881, 0.0036107518209117016, 0.0035200106477478485]}\n",
      "('best n_estimators:', 16)\n",
      "('best cv score:', 0.991620151493148)\n"
     ]
    }
   ],
   "source": [
    "params = {'boosting_type': 'goss',\n",
    "          'objective': 'binary',\n",
    "          'is_unbalance':True,\n",
    "          #'categorical_feature': names:'City', 'Employer_Name', 'Salary_Account','Device_Type','Filled_Form','Gender','Mobile_Verified','Source','Var1','Var2','Var4',\n",
    "          'categorical_feature': categorical_feature,\n",
    "          'n_jobs': 4,\n",
    "          'learning_rate': 0.1,\n",
    "          #'n_estimators':n_estimators_1,\n",
    "          'num_leaves': 60,\n",
    "          'max_depth': 6,\n",
    "          'colsample_bytree': 0.7,\n",
    "          'verbosity':5\n",
    "         }\n",
    "\n",
    "#categorical_feature = ['City', 'Employer_Name', 'Salary_Account','Device_Type','Filled_Form','Gender','Mobile_Verified','Source','Var1','Var2','Var4']\n",
    "n_estimators_1 = get_n_estimators(params, x_train , y_train)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "用了16个estimator,最佳分数为0.99"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 59,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Fitting 5 folds for each of 4 candidates, totalling 20 fits\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "[Parallel(n_jobs=4)]: Using backend LokyBackend with 4 concurrent workers.\n",
      "[Parallel(n_jobs=4)]: Done  10 tasks      | elapsed:   10.5s\n",
      "[Parallel(n_jobs=4)]: Done  18 out of  20 | elapsed:   16.2s remaining:    1.8s\n",
      "[Parallel(n_jobs=4)]: Done  20 out of  20 | elapsed:   17.0s finished\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "GridSearchCV(cv=StratifiedKFold(n_splits=5, random_state=3, shuffle=True),\n",
       "       error_score='raise-deprecating',\n",
       "       estimator=LGBMClassifier(boosting_type='goss',\n",
       "        categorical_feature=[0, 1, 6, 7, 8, 10, 16, 17, 18, 19, 20],\n",
       "        class_weight=None, colsample_bytree=0.7, importance_type='split',\n",
       "        is_unbalance=True, learning_rate=0.1, max_depth=6,\n",
       "        min_child_samples=20, min_child_weight=0.00....0, reg_lambda=0.0, silent=False,\n",
       "        subsample=1.0, subsample_for_bin=200000, subsample_freq=0),\n",
       "       fit_params=None, iid='warn', n_jobs=4,\n",
       "       param_grid={'num_leaves': [50, 60, 70, 80]},\n",
       "       pre_dispatch='2*n_jobs', refit=False, return_train_score='warn',\n",
       "       scoring='roc_auc', verbose=5)"
      ]
     },
     "execution_count": 59,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "params = {'boosting_type': 'goss',\n",
    "          'objective': 'binary',\n",
    "          'is_unbalance':True,\n",
    "          'categorical_feature': categorical_feature,\n",
    "          'n_jobs': 4,\n",
    "          'learning_rate': 0.1,\n",
    "          'n_estimators':n_estimators_1,\n",
    "          #'num_leaves': 60,\n",
    "          'max_depth': 6,\n",
    "          'colsample_bytree': 0.7,\n",
    "         }\n",
    "lg = LGBMClassifier(silent=False,  **params)\n",
    "\n",
    "num_leaves_s = range(50,90,10) #50,60,70,80\n",
    "tuned_parameters = dict( num_leaves = num_leaves_s)\n",
    "\n",
    "grid_search = GridSearchCV(lg, n_jobs=4, param_grid=tuned_parameters, cv = kfold, scoring=\"roc_auc\", verbose=5, refit = False)\n",
    "grid_search.fit(x_train , y_train)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 61,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "0.9915392295557593\n",
      "{'num_leaves': 60}\n"
     ]
    }
   ],
   "source": [
    "print(grid_search.best_score_)\n",
    "print(grid_search.best_params_)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 62,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAZ8AAAELCAYAAAAGFYvBAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMi4zLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvIxREBQAAIABJREFUeJzt3XmYVPWd7/H3h6bZNxFEZV9NMEE07R4FRIxLookal8QkZjOLqHHJJLkzN8+M9/p4nSgu0ZgQY4yTRLMZYxwzggiKa2xEUCQ0zd6g0ICyytLN9/5Rh5mybbobuqtOVffn9Tz9dNXvnDrn+/PQ9fF36tTvKCIwMzPLp3ZpF2BmZm2Pw8fMzPLO4WNmZnnn8DEzs7xz+JiZWd45fMzMLO8cPmZmlncOHzMzyzuHj5mZ5V37tAsoVH369IkhQ4akXYaZWdGYM2fO+ojo25R1HT77MGTIEMrLy9Muw8ysaEha0dR1fdrNzMzyzuFjZmZ55/AxM7O8y2n4SDpT0iJJl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<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "test_means = grid_search.cv_results_[ 'mean_test_score' ]\n",
    "test_stds = grid_search.cv_results_[ 'std_test_score' ]\n",
    "train_means = grid_search.cv_results_[ 'mean_train_score' ]\n",
    "train_stds = grid_search.cv_results_[ 'std_train_score' ]\n",
    "\n",
    "n_leafs = len(num_leaves_s)\n",
    "\n",
    "x_axis = num_leaves_s\n",
    "matplot.plot(x_axis, test_means)\n",
    "#plt.errorbar(x_axis, -test_means, yerr=test_stds,label = ' Test')\n",
    "#plt.errorbar(x_axis, -train_means, yerr=train_stds,label = ' Train')\n",
    "matplot.xlabel( 'num_leaves' )\n",
    "matplot.ylabel( 'AUC' )\n",
    "matplot.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 63,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([0.99144352, 0.99153923, 0.99153923, 0.99153923])"
      ]
     },
     "execution_count": 63,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "test_means"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 64,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Fitting 5 folds for each of 4 candidates, totalling 20 fits\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "[Parallel(n_jobs=4)]: Using backend LokyBackend with 4 concurrent workers.\n",
      "[Parallel(n_jobs=4)]: Done  10 tasks      | elapsed:    7.8s\n",
      "[Parallel(n_jobs=4)]: Done  18 out of  20 | elapsed:   12.9s remaining:    1.4s\n",
      "[Parallel(n_jobs=4)]: Done  20 out of  20 | elapsed:   13.6s finished\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "GridSearchCV(cv=StratifiedKFold(n_splits=5, random_state=3, shuffle=True),\n",
       "       error_score='raise-deprecating',\n",
       "       estimator=LGBMClassifier(boosting_type='goss',\n",
       "        categorical_feature=[0, 1, 6, 7, 8, 10, 16, 17, 18, 19, 20],\n",
       "        class_weight=None, colsample_bytree=0.7, importance_type='split',\n",
       "        is_unbalance=True, learning_rate=0.1, max_depth=6,\n",
       "        min_child_samples=20, min_child_weight=0.00....0, reg_lambda=0.0, silent=False,\n",
       "        subsample=1.0, subsample_for_bin=200000, subsample_freq=0),\n",
       "       fit_params=None, iid='warn', n_jobs=4,\n",
       "       param_grid={'min_child_samples': [10, 20, 30, 40]},\n",
       "       pre_dispatch='2*n_jobs', refit=False, return_train_score='warn',\n",
       "       scoring='roc_auc', verbose=5)"
      ]
     },
     "execution_count": 64,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "params = {'boosting_type': 'goss',\n",
    "          'objective': 'binary',\n",
    "          'is_unbalance':True,\n",
    "          'categorical_feature':categorical_feature,\n",
    "          'n_jobs': 4,\n",
    "          'learning_rate': 0.1,\n",
    "          'n_estimators':n_estimators_1,\n",
    "          'num_leaves': 60,\n",
    "          'max_depth': 6,\n",
    "          'colsample_bytree': 0.7,\n",
    "         }\n",
    "lg = LGBMClassifier(silent=False,  **params)\n",
    "\n",
    "min_child_samples_s = range(10,50,10) \n",
    "tuned_parameters = dict( min_child_samples = min_child_samples_s)\n",
    "\n",
    "grid_search = GridSearchCV(lg, n_jobs=4,  param_grid=tuned_parameters, cv = kfold, scoring=\"roc_auc\", verbose=5, refit = False)\n",
    "grid_search.fit(x_train , y_train)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 65,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "0.9918456411894524\n",
      "{'min_child_samples': 40}\n"
     ]
    }
   ],
   "source": [
    "print(grid_search.best_score_)\n",
    "print(grid_search.best_params_)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 66,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYoAAAD8CAYAAABpcuN4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jYCvwTyAP2O3uoaBJPgkQhOXH4e6Hz8nY4Jw8bWaNYtjFY/Eb4EGgLHjello4JwqKuuU5oDvhS+zNwK9i253omVlzYDLwA3ffG+v+VEcFY0nI8+Lupe7eH0gHBgJ9KmpWu706duXHYWZnAKOB3sAAoA3wUAy7GBUz+wqw1d0XRS6uoGmNnxMFBWwxs1MAgn+3xrg/x83dtwS/FGXAnwj/csc9M0sh/ML6sru/FSxOyPNS0VgS9bwc5u67gVmEP3dpbWbJwap0oCBW/TpWEeMYGpQJ3d0PAS+QGOfkS8DVZrYOeI1wyek31MI5UVDAVOC24PFtwNsx7Eu1HH5hDVwLLD1a23gR1Fj/DKxw919HrEq483K0sSToeUkzs9bB4ybAZYQ/c5kJXB80i/vzcpRxfBLxJsQI1/Tj/py4+2h3T3f3LsBNwL/d/RvUwjmpV1+4M7NXgSGE/9riFuAxYArwBtAJ2ADc4O5x/yHxUcYyhHB5w4F1wD2H6/zxyswuAOYCS/i87voI4dp+Qp2XSsZyM4l3XjIIfzCaRPgN5RvuPsbMuhF+N9sGWAzcErwrj0uVjOPfQBrh0s3HwL0RH3rHPTMbAjzg7l+pjXNSr4JCRESOnUpPIiJSKQWFiIhUSkEhIiKVUlCIiEilFBQiIlIpBYWIiFRKQSEiIpVSUIiISKX+P3yuZT5Zt6x1AAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "test_means = grid_search.cv_results_[ 'mean_test_score' ]\n",
    "test_stds = grid_search.cv_results_[ 'std_test_score' ]\n",
    "train_means = grid_search.cv_results_[ 'mean_train_score' ]\n",
    "train_stds = grid_search.cv_results_[ 'std_train_score' ]\n",
    "\n",
    "x_axis = min_child_samples_s\n",
    "\n",
    "matplot.plot(x_axis, test_means)\n",
    "#plt.errorbar(x_axis, -test_scores, yerr=test_stds ,label = ' Test')\n",
    "#plt.errorbar(x_axis, -train_scores, yerr=train_stds,label =  +' Train')\n",
    "\n",
    "matplot.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 67,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Fitting 5 folds for each of 2 candidates, totalling 10 fits\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "[Parallel(n_jobs=4)]: Using backend LokyBackend with 4 concurrent workers.\n",
      "[Parallel(n_jobs=4)]: Done   6 out of  10 | elapsed:    4.7s remaining:    3.1s\n",
      "[Parallel(n_jobs=4)]: Done  10 out of  10 | elapsed:    7.0s finished\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "GridSearchCV(cv=StratifiedKFold(n_splits=5, random_state=3, shuffle=True),\n",
       "       error_score='raise-deprecating',\n",
       "       estimator=LGBMClassifier(boosting_type='goss',\n",
       "        categorical_feature=[0, 1, 6, 7, 8, 10, 16, 17, 18, 19, 20],\n",
       "        class_weight=None, colsample_bytree=0.7, importance_type='split',\n",
       "        is_unbalance=True, learning_rate=0.1, max_depth=6,\n",
       "        min_child_samples=20, min_child_weight=0.00....0, reg_lambda=0.0, silent=False,\n",
       "        subsample=1.0, subsample_for_bin=200000, subsample_freq=0),\n",
       "       fit_params=None, iid='warn', n_jobs=4,\n",
       "       param_grid={'min_child_samples': [40, 50]}, pre_dispatch='2*n_jobs',\n",
       "       refit=False, return_train_score='warn', scoring='roc_auc',\n",
       "       verbose=5)"
      ]
     },
     "execution_count": 67,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "params = {'boosting_type': 'goss',\n",
    "          'objective': 'binary',\n",
    "          'is_unbalance':True,\n",
    "          'categorical_feature': categorical_feature,\n",
    "          'n_jobs': 4,\n",
    "          'learning_rate': 0.1,\n",
    "          'n_estimators':n_estimators_1,\n",
    "          'num_leaves': 60,\n",
    "          'max_depth': 6,\n",
    "          'colsample_bytree': 0.7,\n",
    "         }\n",
    "lg = LGBMClassifier(silent=False,  **params)\n",
    "\n",
    "min_child_samples_s = range(40,60,10) \n",
    "tuned_parameters = dict( min_child_samples = min_child_samples_s)\n",
    "\n",
    "grid_search = GridSearchCV(lg, n_jobs=4,  param_grid=tuned_parameters, cv = kfold, scoring=\"roc_auc\", verbose=5, refit = False)\n",
    "grid_search.fit(x_train , y_train)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 68,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "0.9918456411894524\n",
      "{'min_child_samples': 40}\n"
     ]
    }
   ],
   "source": [
    "print(grid_search.best_score_)\n",
    "print(grid_search.best_params_)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 69,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAZYAAAEDCAYAAAAWUyJmAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMi4zLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvIxREBQAAIABJREFUeJzt3Xl4FGW2x/HvSQJh3wIoAhqEoAZBxAjKEhxlFQVUVNRxxR1EiDMDzjhzR8friHNvABXGfV8QcSEisqmTALIFZEckLAqiArIooqzn/tHlnUxMSAOddJbf53l46H7rrVPnbaAP1VV9Yu6OiIhIpMREOwERESlbVFhERCSiVFhERCSiVFhERCSiVFhERCSiVFhERCSiVFjyYWZnmNkcM1tmZu+ZWY0C5t1tZsvNbIWZDck1fnkwdsjMUnKNVzCzF4O4q8zs3gjkmmpmi8zsgJn1O9Z4IiLHqtwXFjM7z8xeyDP8DDDc3VsC7wC/z2e/04FbgLbAGcBFZpYUbF4OXApk5dntciA+iHsWcJuZJR7jEr4EbgBeO8Y4IiIRUe4LSwFO4d9FYTpwWT5zTgPmuvsedz8AZAKXALj7Kndfnc8+DlQ1szigMrAP+B7AzH5rZv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WzE4DLgceillgROsyfcTzwc/CRydPAc8WeXBE5zJqHAhe6eyPgeSC92JMrWh3cvQ3QExhoZqnFcdC44jhIKdYB6G1mFwKVCJ0yjwJqmVlccNbSiLJ1+vyrNZvZK+7+WzP7L6AecFtUM4ys/P6MVwB7gZzQJ59UMbMcdy8rF3bz/TMmdPb9VjDnHUJvtGVFfmt+n9D1pHnBnDcoW2fiuPvm4PctZvYO0Bb41swauPvXZtYAiPxHnu6uX2H8As4DJgWP3wT6B4+fAO6Mdn7FsOabgU+AytHOqzjWm2d8d7RzK6Y/44eBm3KNL4h2fkW5ZkL/sd4GNA/GBwBvRTu/CK6zKlA91+NPgB6Erh0OD8aHA49E+tg6Yzk6w4BxZvYg8CnwbJTzKQ5PEPpRA3OC/8W/7e4PRDclibCHgVfNbCiwm7J3599/cPcDZnYL8JaZHSJ0h+dNUU4rko4D3gn+vcYBr7n7FDNbAIw3swHAl4Q+9o0otXQREZGI0sV7ERGJKBUWERGJKBUWERGJKBUWERGJKBUWERGJKBUWERGJKBUWERGJqP8DOhUKRM+CaXAAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "test_means = grid_search.cv_results_[ 'mean_test_score' ]\n",
    "test_stds = grid_search.cv_results_[ 'std_test_score' ]\n",
    "train_means = grid_search.cv_results_[ 'mean_train_score' ]\n",
    "train_stds = grid_search.cv_results_[ 'std_train_score' ]\n",
    "\n",
    "x_axis = min_child_samples_s\n",
    "\n",
    "matplot.plot(x_axis, test_means)\n",
    "#plt.errorbar(x_axis, -test_scores, yerr=test_stds ,label = ' Test')\n",
    "#plt.errorbar(x_axis, -train_scores, yerr=train_stds,label =  +' Train')\n",
    "\n",
    "matplot.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 70,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Fitting 5 folds for each of 5 candidates, totalling 25 fits\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "[Parallel(n_jobs=4)]: Using backend LokyBackend with 4 concurrent workers.\n",
      "[Parallel(n_jobs=4)]: Done  10 tasks      | elapsed:    7.3s\n",
      "[Parallel(n_jobs=4)]: Done  25 out of  25 | elapsed:   16.7s finished\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "GridSearchCV(cv=StratifiedKFold(n_splits=5, random_state=3, shuffle=True),\n",
       "       error_score='raise-deprecating',\n",
       "       estimator=LGBMClassifier(boosting_type='goss',\n",
       "        categorical_feature=[0, 1, 6, 7, 8, 10, 16, 17, 18, 19, 20],\n",
       "        class_weight=None, colsample_bytree=1.0, importance_type='split',\n",
       "        is_unbalance=True, learning_rate=0.1, max_depth=6,\n",
       "        min_child_samples=40, min_child_weight=0.00....0, reg_lambda=0.0, silent=False,\n",
       "        subsample=1.0, subsample_for_bin=200000, subsample_freq=0),\n",
       "       fit_params=None, iid='warn', n_jobs=4,\n",
       "       param_grid={'colsample_bytree': [0.5, 0.6, 0.7, 0.8, 0.9]},\n",
       "       pre_dispatch='2*n_jobs', refit=False, return_train_score='warn',\n",
       "       scoring='roc_auc', verbose=5)"
      ]
     },
     "execution_count": 70,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "params = {'boosting_type': 'goss',\n",
    "          'objective': 'binary',\n",
    "          'is_unbalance':True,\n",
    "          'categorical_feature': categorical_feature,\n",
    "          'n_jobs': 4,\n",
    "          'learning_rate': 0.1,\n",
    "          'n_estimators':n_estimators_1,\n",
    "          'num_leaves': 60,\n",
    "          'max_depth': 6,\n",
    "          'min_child_samples':40\n",
    "          #'colsample_bytree': 0.7,\n",
    "         }\n",
    "lg = LGBMClassifier(silent=False,  **params)\n",
    "\n",
    "colsample_bytree_s = [i/10.0 for i in range(5,10)]\n",
    "tuned_parameters = dict( colsample_bytree = colsample_bytree_s)\n",
    "\n",
    "grid_search = GridSearchCV(lg, n_jobs=4,  param_grid=tuned_parameters, cv = kfold, scoring=\"roc_auc\", verbose=5, refit = False)\n",
    "grid_search.fit(x_train , y_train)\n",
    "#grid_search.best_estimator_"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 71,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "0.9918456411894524\n",
      "{'colsample_bytree': 0.7}\n"
     ]
    }
   ],
   "source": [
    "print(grid_search.best_score_)\n",
    "print(grid_search.best_params_)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 72,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAX0AAAD8CAYAAACb4nSYAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMi4zLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvIxREBQAAIABJREFUeJzt3Xt8FPW9//HXJwkXuQlCBCXc5RYURAOCVlGqFW+gYj1ovVCv9Rx76jnaU62tItWqP21te7S1FFGxVaqetuCtqAhqFYUgNwMEQhQJQYwgd0Jun98fmei6BLOBTWaz+34+HnlkduY7M++dbD4zO9+dWXN3REQkNaSFHUBERBqPir6ISApR0RcRSSEq+iIiKURFX0Qkhajoi4ikEBV9EZEUoqIvIpJCVPRFRFJIRtgBonXq1Ml79uwZdgwRkSZl0aJFn7t7Zl3tEq7o9+zZk9zc3LBjiIg0KWa2LpZ2Or0jIpJCVPRFRFKIir6ISApR0RcRSSEq+iIiKURFX0Qkhajoi4ikkIT7nL5IonpxWTFrNu2kWbqRkZ5GRppV/9QMp6fRLN1ITzMy0r4abhYxvfp39bj0NKNZWhoZ6RHLqRkO5jezsJ+2JBkVfZE6uDv3vbKKP75V2OjrTk8LdhxRO42MiJ1FzQ4kIz0taBc5vZYdTTD+y+FgvvRgnuqdVdqX7b5cZ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uufkA/M3snWP+YeswbRi4Id3sB1W/BqT46faO+8zZyLmi47RVrtknAZWZWBLxM9TuRWOcNIxdAr+C0z5tmdnKcMsWaaykwPhi+AGhrZh1jnDdmTaXo1/ZN59EfO3oB6Onug4HXgSfrMW8YuQC6e/XVd5cCvzGzPo2YK4PqUymnUn2EONXM2sc4bxi5INztVWMC8Ly7Vx7AvPV1MLmg4bZXrNkuAZ5w9yzgbOApM0uLcd4wcm2kepsNBf4beNrM2hEfseS6BRhlZouBUcAGoCLGeWPWVIp+ERB5hJxF1Fsyd9/s7nuDh38Cjo913pBy4e7Fwe9CYB4wtLFyBW1munt58BY7n+piG+r2+oZcYW+vGhP4+imUsLfX/nI15PaKNdvVwLNBhvlAS6rvLRP2Nqs1V3C6aXMwfhHV5+D7NVYudy929wuDnc7twbhtMT6n2DVEp0UDdIJkUN150YuvOkEGRbU5ImL4AuC9iE6Qj6juAOkQDB+WALk6AC2C4U7AGr6hk64Bco0BnoxY/3qgYwJsr/3lCnV7Be36Ax8TXN+SCK+vb8jVYNurHn/LV4CJwfBAqguVAYP4ekduIfHryD2YXJk1OajucN3QyK/9TkBaMHwPMLkhXmNxeQE0xg/Vb8NWU733vT0YNxkYGwzfC+QFG3MuMCBi3quo7iwqAL6fCLmAE4HlwfjlwNWNnMuAXwMrgvVPSJDtVWuusLdX8HgScF8t84a2vfaXq6G3V4x/y2zgnSDDEuA7EfPeHsyXD5yVCLmoPp9e87/6AXBeI+e6iOqd82pgKsFOO96vMV2RKyKSQprKOX0REYkDFX0RkRSioi8ikkJU9EVEUoiKvohIClHRFxFJISr6IiIpREVfRCSF/H9Sq5Welt+r5gAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "test_means = grid_search.cv_results_[ 'mean_test_score' ]\n",
    "test_stds = grid_search.cv_results_[ 'std_test_score' ]\n",
    "train_means = grid_search.cv_results_[ 'mean_train_score' ]\n",
    "train_stds = grid_search.cv_results_[ 'std_train_score' ]\n",
    "\n",
    "x_axis = colsample_bytree_s\n",
    "\n",
    "matplot.plot(x_axis, test_means)\n",
    "#plt.errorbar(x_axis, -test_scores[:,i], yerr=test_stds[:,i] ,label = str(max_depths[i]) +' Test')\n",
    "#plt.errorbar(x_axis, -train_scores[:,i], yerr=train_stds[:,i] ,label = str(max_depths[i]) +' Train')\n",
    "\n",
    "matplot.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 73,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Fitting 5 folds for each of 3 candidates, totalling 15 fits\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "[Parallel(n_jobs=4)]: Using backend LokyBackend with 4 concurrent workers.\n",
      "[Parallel(n_jobs=4)]: Done  12 out of  15 | elapsed:    9.1s remaining:    2.3s\n",
      "[Parallel(n_jobs=4)]: Done  15 out of  15 | elapsed:   10.8s finished\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "GridSearchCV(cv=StratifiedKFold(n_splits=5, random_state=3, shuffle=True),\n",
       "       error_score='raise-deprecating',\n",
       "       estimator=LGBMClassifier(boosting_type='goss',\n",
       "        categorical_feature=[0, 1, 6, 7, 8, 10, 16, 17, 18, 19, 20],\n",
       "        class_weight=None, colsample_bytree=1.0, importance_type='split',\n",
       "        is_unbalance=True, learning_rate=0.1, max_depth=6,\n",
       "        min_child_samples=40, min_child_weight=0.00....0, reg_lambda=0.0, silent=False,\n",
       "        subsample=1.0, subsample_for_bin=200000, subsample_freq=0),\n",
       "       fit_params=None, iid='warn', n_jobs=4,\n",
       "       param_grid={'colsample_bytree': [0.3, 0.4, 0.5]},\n",
       "       pre_dispatch='2*n_jobs', refit=False, return_train_score='warn',\n",
       "       scoring='roc_auc', verbose=5)"
      ]
     },
     "execution_count": 73,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "params = {'boosting_type': 'goss',\n",
    "          'objective': 'binary',\n",
    "          'is_unbalance':True,\n",
    "          'categorical_feature': categorical_feature,\n",
    "          'n_jobs': 4,\n",
    "          'learning_rate': 0.1,\n",
    "          'n_estimators':n_estimators_1,\n",
    "          'num_leaves': 60,\n",
    "          'max_depth': 6,\n",
    "          'min_child_samples':40\n",
    "          #'colsample_bytree': 0.7,\n",
    "         }\n",
    "lg = LGBMClassifier(silent=False,  **params)\n",
    "\n",
    "colsample_bytree_s = [i/10.0 for i in range(3,6)]\n",
    "tuned_parameters = dict( colsample_bytree = colsample_bytree_s)\n",
    "\n",
    "grid_search = GridSearchCV(lg, n_jobs=4,  param_grid=tuned_parameters, cv = kfold, scoring=\"roc_auc\", verbose=5, refit = False)\n",
    "grid_search.fit(x_train , y_train)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 74,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "0.926693884704295\n",
      "{'colsample_bytree': 0.5}\n"
     ]
    }
   ],
   "source": [
    "print(grid_search.best_score_)\n",
    "print(grid_search.best_params_)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "no need to adjust anymore"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 76,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "{u'auc-mean': [0.9873134637460504, 0.9859470326042888, 0.9909234484844047, 0.9911104458379978, 0.991286105638229, 0.9911912694102811, 0.99126077579985, 0.9912654317078362, 0.9913921767369986, 0.9913611453160053, 0.991353939945699, 0.9913290180776263, 0.9913736771328321, 0.9913718732407079, 0.9915320291220956, 0.991544893472479, 0.9915266521024162, 0.9915948841754723, 0.9915750022918326, 0.991570488901889, 0.9915343710291866, 0.9915370217618928, 0.9915487570778063, 0.9915297940463269, 0.9915701013631768, 0.9915747952339051, 0.9915798576102667, 0.9915655084942776, 0.9915793292574675, 0.9915648477488777, 0.9915600140721044, 0.9915494445680831, 0.9915769883660305, 0.9915886227299227, 0.9915728090206045, 0.9915335506715699, 0.9915348550937824, 0.9915200585840012, 0.9915088743096779, 0.991511861159986, 0.9915040873311721, 0.991512201293262, 0.9915056132679059, 0.9914637755544191, 0.9914676393065769, 0.9914801833096453, 0.9914691731581613, 0.991469134753322, 0.9914813727062505, 0.9915072688723814, 0.9915178807986698, 0.9915316997424869, 0.9915471078722652, 0.9915371563195189, 0.9915323275231387, 0.9915299527781812, 0.9915359821268351, 0.9915287998026052, 0.9915530365203834, 0.991585304002012, 0.9915843082180368, 0.9915833478125491, 0.9916070461806166, 0.9916196203937145, 0.9916179467958148, 0.9916108783028534, 0.991619638286914, 0.9916353328616763, 0.9916201020405608, 0.99162261106224, 0.9916251034837813, 0.9915784579208269, 0.9915871118203053, 0.9915809098515836, 0.9915794060196166, 0.9915781538342234, 0.9915762823730274, 0.9915852910132588, 0.9915896258328912, 0.9916159672210594, 0.991580206197135, 0.9916033292544506, 0.9916184048707569, 0.9916157741871723, 0.9916126461164192, 0.9916046905257592, 0.9916140924479034, 0.9916126463190944, 0.9915611029728228, 0.9915854097434407, 0.9915816612045202, 0.9916038264188908, 0.9916162097790326, 0.9915958894585739, 0.9915810645421352, 0.9915770360072139, 0.9915897514691887, 0.9915962216286719, 0.9916028963136198, 0.9916074502676322, 0.9916061697980958, 0.9916135711081114, 0.9916118806765736, 0.9916144515669497, 0.9916062540262892, 0.9916047828905764, 0.9916277736374782, 0.9916282260576958, 0.9916272208465969, 0.9916306874555779, 0.9916373958585758, 0.9916427513905222, 0.9916473836320282, 0.9916524581142816, 0.9916483382969297, 0.991618849302672, 0.9916234401156533, 0.9916341479904152, 0.9916292047132484, 0.9916429065207668, 0.9916620080231487, 0.991663570541349, 0.9916653904986592, 0.9916605866572856, 0.991665614760004, 0.9916611457994456, 0.9916705281937181, 0.9916697503450914, 0.9916685559376308, 0.9916652906678605, 0.9916848104799735, 0.9916930574438027, 0.991672569135134, 0.9916726559640662, 0.9916692256178716, 0.9916698217566019, 0.9916770465796377, 0.9916837711198774, 0.9916782786569776, 0.9916770012351277, 0.9916762689523535, 0.9916930004699559, 0.9916949328847764, 0.9917051170078135, 0.9917074767238381, 0.9916958665707639, 0.9916979807982045, 0.991692630065157, 0.9916849433227769, 0.9916862669933847, 0.9916844215081934, 0.99168214027839, 0.9917047878894547, 0.9917028160654905, 0.9917117603124991, 0.9917040244964032, 0.9917126907425816, 0.9917238450569645, 0.9917370230712652, 0.9917316232712216, 0.9917446984900223, 0.9917438772229292, 0.9917430132348899, 0.9917473117585061, 0.9917366585752697, 0.9917496648175386, 0.9917660831507081, 0.991763613519453, 0.9917637481643474, 0.9917638788092009, 0.9917739365953862, 0.9917837317858995, 0.9917780083833284, 0.9917851437552543, 0.9917789822986516, 0.9917751842565588, 0.9917779752428982, 0.9917854878925191, 0.9917875924473872, 0.9917696115186807, 0.991771039614715, 0.991766512208143, 0.9917667978980091, 0.9917658478759476, 0.9917722432918541, 0.9917691284335379, 0.9917687676599239, 0.9917737511571447, 0.9917805702836173, 0.9917942546507004, 0.9917931100038084, 0.9917942119498072, 0.9917962680965833, 0.9917998190470433, 0.9917967510816693, 0.9918047993272898, 0.9917933117018585, 0.9917943604874824, 0.9917935940719215, 0.9917982555685928, 0.9917944591763748, 0.991793357569162, 0.9917951343256106, 0.99180144154688, 0.9918087105140605, 0.9918088544646881, 0.9918162274198383, 0.9918142111343826, 0.9918114588062265, 0.9918100421526447, 0.9918095273810958, 0.9918099375498249, 0.9918100322853973, 0.9918079244027261, 0.9918050898778104, 0.9918081167601649, 0.9918050070475337, 0.9918055093096042, 0.9918181269131144, 0.9918199457194475, 0.991818710415642, 0.9918263528912054, 0.9918279555521234, 0.9918396636710781, 0.9918389804339661, 0.9918593766358548, 0.9918595153501268, 0.9918587854828027, 0.9918596124144266, 0.9918599358635616, 0.9918591002143866, 0.9918651014762393, 0.9918635022657961, 0.9918637304365117, 0.9918656066366565, 0.9918604393447694, 0.9918669044665199, 0.9918681317623476, 0.9918655233314831, 0.991869141376171, 0.9918702375415818, 0.9918703295202516, 0.9918692780390608, 0.9918635604316925, 0.9918709708766624, 0.9918697845678501, 0.9918717055014978, 0.9918588971491408, 0.9918586972652349, 0.991860057430744, 0.9918632741376439, 0.9918627244917341, 0.9918644066978992, 0.9918683898163074, 0.9918691678929962, 0.9918779054590487, 0.9918804198411934, 0.9918812436424608, 0.991886455578566, 0.9918871350370843], u'auc-stdv': [0.0055394222788599096, 0.007039314974244533, 0.003193126007167817, 0.0034299582938429707, 0.003602060941250037, 0.0036538431752809004, 0.0035513381521700056, 0.003536949750443747, 0.003408340249070624, 0.0034114493071639752, 0.003431735568682977, 0.0034622146716671662, 0.003509658932698741, 0.0035137919778041233, 0.003138620944849801, 0.003156152369712203, 0.0031629544332449637, 0.003067737783521557, 0.0030721472154305748, 0.0030898132723983073, 0.0031234163653146184, 0.003144858741933539, 0.003162644369266892, 0.003164410337308276, 0.0030948573789119473, 0.0030885094503821328, 0.00307140036446306, 0.0030765951022565974, 0.0030752149975329843, 0.0030559712767069228, 0.0030698931764213365, 0.0030789608872950043, 0.00303736299893888, 0.002997734121334418, 0.0030821307386555844, 0.003143798299030217, 0.0031439265111905612, 0.0031577872536314054, 0.0031616368837001072, 0.003164235103312684, 0.003178114053701473, 0.0031863590208858206, 0.0031806315250348027, 0.0032647845722382223, 0.003235476045094413, 0.003197927469846071, 0.003193436299522419, 0.0031964733866209605, 0.003177590305887294, 0.0031230777672394986, 0.0030961775953552194, 0.0031035585592642037, 0.003069935319938372, 0.003080197746505681, 0.0030869065650397294, 0.0030865876419140397, 0.0030688094016195467, 0.0030729530300442364, 0.00308068494532551, 0.00309128234234442, 0.0030907086355080825, 0.003089517104251502, 0.003041858647790778, 0.003030723816295401, 0.0030267947920471655, 0.0030289452295754324, 0.003034113090663864, 0.002993745496647518, 0.002999245151884395, 0.0029999816168445152, 0.002995078825050357, 0.003069240645487012, 0.0030590211083451617, 0.0030663124140471072, 0.0030682442118062864, 0.0030709569686288795, 0.0030721738962190023, 0.0030716633099162043, 0.0030787114073220255, 0.0030831680593782127, 0.00314472653455964, 0.0031616917773834284, 0.0031248423218253308, 0.003123643297748424, 0.0031282123598948964, 0.003135145535763925, 0.003142540270837196, 0.0031505273594151797, 0.0032282025172988907, 0.0032294420759344513, 0.0032318338750146353, 0.003178742970247246, 0.0031481513963498207, 0.0031820255305318682, 0.0031825672455196015, 0.0031834477143860185, 0.0031898504764206986, 0.003197993280494792, 0.003198254531384591, 0.003203402065298692, 0.003204023299602799, 0.003188372128305241, 0.0031929185909290035, 0.0031792441507806453, 0.0031817040767644395, 0.0031759429218372573, 0.003128505460036577, 0.0031239752896355644, 0.0031243605303733026, 0.0031227879386466015, 0.00311367436953546, 0.0031119209275741223, 0.0031168726297176996, 0.0031220342080841177, 0.003123792948376802, 0.0031609636226748433, 0.00316426697334732, 0.0031615854453344527, 0.0031612987297180766, 0.0031545366120764124, 0.0031205947126077592, 0.0031197686649227833, 0.0031222192487423642, 0.0031231315755037357, 0.003120296321029225, 0.0031477872890937346, 0.0031504903039408054, 0.0031496811838054575, 0.0031507864780641517, 0.003168190839807135, 0.0031763428597867053, 0.003166591187365788, 0.003213829032329306, 0.0032162195985307764, 0.003218781401986494, 0.003222081705521773, 0.0032262323284024284, 0.0032265898481277635, 0.003224761709215803, 0.0032283939169293102, 0.00323530447072572, 0.0032061919067113815, 0.0032066242586102746, 0.003180512729071261, 0.003170317596833556, 0.0032006894775618694, 0.003202805625190195, 0.0032092771955947283, 0.0032142609457626687, 0.0032098986342148396, 0.0032164363590706335, 0.0032186290943514344, 0.00319007417198228, 0.003189877633778004, 0.0031690559712318333, 0.0031779829234121182, 0.0031834983603124547, 0.0031642099258260372, 0.0031449804699364464, 0.003146567303737706, 0.0031163271926316245, 0.003115193040498113, 0.0031173047768830887, 0.0031118834733403515, 0.003129343989895853, 0.0031287280040539454, 0.0031023092296341044, 0.0031084046643735813, 0.0031075902627752732, 0.0031092865925806956, 0.003090662807672082, 0.0030904268420513634, 0.003091961104525813, 0.0030903237882821026, 0.0030949190784657797, 0.0030955807680029704, 0.0030944317341844844, 0.0030962354646088793, 0.0030965813779786078, 0.003122324465416208, 0.0031234745614222978, 0.0031261767726251844, 0.0031280501636289067, 0.003133753911766184, 0.00313885726894396, 0.003139008444493821, 0.003140999455880817, 0.0031373752410397385, 0.0031354225300057824, 0.003117775937113935, 0.0031149804201588706, 0.0031138433124765262, 0.003114363448042916, 0.0031032343024860703, 0.003106010983196165, 0.003092968215922676, 0.0030964716277441465, 0.003098697760785614, 0.003107700848238656, 0.0030994712761717182, 0.0031032421930522747, 0.003101593468278844, 0.0030821101164983746, 0.003065933563342616, 0.003052592850015702, 0.0030539094142921917, 0.0030445277099624087, 0.0030448215827965546, 0.003045615359806914, 0.003046892128670017, 0.0030406819574144662, 0.003037851457061379, 0.0030371756035855266, 0.0030379079464523855, 0.003040800098194919, 0.003043282019699778, 0.0030444357146255964, 0.003047273119086196, 0.003027174053765394, 0.0030183234835209896, 0.0030195932857814234, 0.0030175847718676126, 0.0030201903587332383, 0.0030068080447291272, 0.003008745646325189, 0.0029765369932521005, 0.002973299927834718, 0.0029756069389803162, 0.002978213648549788, 0.0029768872075734117, 0.0029681827779492113, 0.0029648728146519847, 0.0029663893454988837, 0.002966670939329326, 0.0029609308222147968, 0.0029683025033450166, 0.0029706023895591416, 0.0029661668035301492, 0.0029671320994928085, 0.0029693964440758425, 0.002971652250662404, 0.0029690785885656697, 0.0029698566773410017, 0.0029810909504340566, 0.002969451511633243, 0.002969394101250341, 0.0029694030612339743, 0.00298153039665424, 0.0029704241174713436, 0.0029578412026340624, 0.002963212764758952, 0.0029655344555966894, 0.0029552667535274173, 0.002957021531766776, 0.002958375934250444, 0.002945702990106814, 0.00294748667284784, 0.002948864631885786, 0.002943453250003468, 0.002942298080959521]}\n",
      "('best n_estimators:', 260)\n",
      "('best cv score:', 0.9918871350370843)\n"
     ]
    }
   ],
   "source": [
    "params = {'boosting_type': 'goss',\n",
    "          'objective': 'binary',\n",
    "          'is_unbalance':True,\n",
    "          'categorical_feature': categorical_feature,\n",
    "          'n_jobs': 4,\n",
    "          'learning_rate': 0.01,\n",
    "          #'n_estimators':n_estimators_1,\n",
    "          'num_leaves': 60,\n",
    "          'max_depth': 6,\n",
    "          'min_child_samples':40,\n",
    "          'colsample_bytree': 0.7\n",
    "         }\n",
    "n_estimators_2 = get_n_estimators(params , x_train , y_train, early_stopping_rounds=50)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 43,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "LGBMClassifier(boosting_type='goss',\n",
       "        categorical_feature=[1, 2, 7, 8, 9, 11, 17, 18, 19, 20, 21],\n",
       "        class_weight=None, colsample_bytree=0.4, importance_type='split',\n",
       "        is_unbalance=True, learning_rate=0.01, max_depth=6,\n",
       "        min_child_samples=40, min_child_weight=0.001, min_split_gain=0.0,\n",
       "        n_estimators=100, n_jobs=4, num_leaves=75, objective='binary',\n",
       "        random_state=None, reg_alpha=0.0, reg_lambda=0.0, silent=False,\n",
       "        subsample=1.0, subsample_for_bin=200000, subsample_freq=0)"
      ]
     },
     "execution_count": 43,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "params = {'boosting_type': 'goss',\n",
    "          'objective': 'binary',\n",
    "          'is_unbalance':True,\n",
    "          'categorical_feature': categorical_feature,\n",
    "          'n_jobs': 4,\n",
    "          'learning_rate': 0.01,\n",
    "          'n_estimators':n_estimators_2,\n",
    "          'num_leaves': 60,\n",
    "          'max_depth': 6,\n",
    "          'min_child_samples':40,\n",
    "          'colsample_bytree': 0.7\n",
    "         }\n",
    "\n",
    "lg = LGBMClassifier(silent=False,  **params)\n",
    "lg.fit(x_train, y_train)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 45,
   "metadata": {},
   "outputs": [],
   "source": [
    "import cPickle\n",
    "\n",
    "cPickle.dump(lg, open(\"HappyBank_LightGBM_.pkl\", 'wb'))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 46,
   "metadata": {},
   "outputs": [],
   "source": [
    "df = pandas.DataFrame({\"columns\":list(feat_names), \"importance\":list(lg.feature_importances_.T)})\n",
    "df = df.sort_values(by=['importance'],ascending=False)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 47,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>columns</th>\n",
       "      <th>importance</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>Unnamed: 0</td>\n",
       "      <td>643</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>Monthly_Income</td>\n",
       "      <td>630</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>Var5</td>\n",
       "      <td>399</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>Loan_Amount_Submitted</td>\n",
       "      <td>394</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14</th>\n",
       "      <td>Interest_Rate</td>\n",
       "      <td>360</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>Existing_EMI</td>\n",
       "      <td>351</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>26</th>\n",
       "      <td>Age</td>\n",
       "      <td>346</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>16</th>\n",
       "      <td>EMI_Loan_Submitted</td>\n",
       "      <td>307</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>15</th>\n",
       "      <td>Processing_Fee</td>\n",
       "      <td>224</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>Loan_Amount_Applied</td>\n",
       "      <td>207</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>Loan_Tenure_Applied</td>\n",
       "      <td>199</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>City</td>\n",
       "      <td>166</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>Loan_Tenure_Submitted</td>\n",
       "      <td>165</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>Employer_Name</td>\n",
       "      <td>136</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>Salary_Account</td>\n",
       "      <td>123</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>20</th>\n",
       "      <td>Source</td>\n",
       "      <td>88</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>Gender</td>\n",
       "      <td>66</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>18</th>\n",
       "      <td>Device_Type</td>\n",
       "      <td>56</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>21</th>\n",
       "      <td>Var4</td>\n",
       "      <td>49</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>17</th>\n",
       "      <td>Filled_Form</td>\n",
       "      <td>45</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>Mobile_Verified</td>\n",
       "      <td>39</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>22</th>\n",
       "      <td>LoggedIn</td>\n",
       "      <td>34</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>24</th>\n",
       "      <td>Interest_Rate_Missing</td>\n",
       "      <td>31</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>Var1</td>\n",
       "      <td>29</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>19</th>\n",
       "      <td>Var2</td>\n",
       "      <td>24</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>25</th>\n",
       "      <td>Processing_Fee_Missing</td>\n",
       "      <td>21</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>23</th>\n",
       "      <td>EMI_Loan_Submitted_Missing</td>\n",
       "      <td>13</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>27</th>\n",
       "      <td>Lead_Creation_Year</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                       columns  importance\n",
       "0                   Unnamed: 0         643\n",
       "3               Monthly_Income         630\n",
       "10                        Var5         399\n",
       "12       Loan_Amount_Submitted         394\n",
       "14               Interest_Rate         360\n",
       "6                 Existing_EMI         351\n",
       "26                         Age         346\n",
       "16          EMI_Loan_Submitted         307\n",
       "15              Processing_Fee         224\n",
       "4          Loan_Amount_Applied         207\n",
       "5          Loan_Tenure_Applied         199\n",
       "2                         City         166\n",
       "13       Loan_Tenure_Submitted         165\n",
       "7                Employer_Name         136\n",
       "8               Salary_Account         123\n",
       "20                      Source          88\n",
       "1                       Gender          66\n",
       "18                 Device_Type          56\n",
       "21                        Var4          49\n",
       "17                 Filled_Form          45\n",
       "9              Mobile_Verified          39\n",
       "22                    LoggedIn          34\n",
       "24       Interest_Rate_Missing          31\n",
       "11                        Var1          29\n",
       "19                        Var2          24\n",
       "25      Processing_Fee_Missing          21\n",
       "23  EMI_Loan_Submitted_Missing          13\n",
       "27          Lead_Creation_Year           0"
      ]
     },
     "execution_count": 47,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 2",
   "language": "python",
   "name": "python2"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.15"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
